package com.panwenliang2008.eatwhat.ui.selectoption

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.panwenliang2008.eatwhat.data.FoodRepository
import com.panwenliang2008.eatwhat.data.entity.Food
import kotlinx.coroutines.launch

class SelectOptionViewModel internal constructor(
    private val foodRepository: FoodRepository,
    private val savedStateHandle: SavedStateHandle
) : ViewModel() {

    fun getAll() = foodRepository.getAll()

    fun delete(food: Food) {
        viewModelScope.launch {
            foodRepository.delete(food)
        }
    }

    fun insert(food: Food) {
        viewModelScope.launch {
            foodRepository.insert(food)
        }
    }
}
